import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSubSysServiceAPI } from './ipssub-sys-service-api';
import { IPSSubSysServiceAPIDE } from './ipssub-sys-service-apide';
import { IPSSubSysServiceAPIDERS } from './ipssub-sys-service-apiders';
import { IPSSubSysServiceAPIDTO } from './ipssub-sys-service-apidto';
import { IPSOpenAPI3Schema } from './openapi/ipsopen-api3-schema';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSubSysServiceAPIImpl extends PSModelObjectImpl implements IPSSubSysServiceAPI {
  get aPISource(): 'NONE' | 'SYSAPI' | 'DEVSYSAPI' | 'PREDEFINED' {
    return this.M.aPISource;
  }

  get aPITag(): string {
    return this.M.aPITag;
  }

  get aPITag2(): string {
    return this.M.aPITag2;
  }

  get aPIType(): 'RESTFUL' | 'JAXRS' | 'WEBSERVICE' | 'USER' | 'USER2' {
    return this.M.aPIType;
  }

  protected allpssubsysserviceapiderss: IPSSubSysServiceAPIDERS[] | null = null;

  getAllPSSubSysServiceAPIDERSs(): IPSSubSysServiceAPIDERS[] | null {
    if (this.allpssubsysserviceapiderss == null) {
      this.allpssubsysserviceapiderss = this.fillChildListModel(this.M.getAllPSSubSysServiceAPIDERSs, 'service.IPSSubSysServiceAPIDERS') as IPSSubSysServiceAPIDERS[];
    }
    return this.allpssubsysserviceapiderss;
  }

  get allPSSubSysServiceAPIDERSs(): IPSSubSysServiceAPIDERS[] | null {
    return this.getAllPSSubSysServiceAPIDERSs();
  }

  findPSSubSysServiceAPIDERS(objKey: any): IPSSubSysServiceAPIDERS | null {
    return this.getPSModel5('service.IPSSubSysServiceAPIDERS', this.getAllPSSubSysServiceAPIDERSs(), objKey) as IPSSubSysServiceAPIDERS;
  }

  protected allpssubsysserviceapides: IPSSubSysServiceAPIDE[] | null = null;

  getAllPSSubSysServiceAPIDEs(): IPSSubSysServiceAPIDE[] | null {
    if (this.allpssubsysserviceapides == null) {
      this.allpssubsysserviceapides = this.fillChildListModel(this.M.getAllPSSubSysServiceAPIDEs, 'service.IPSSubSysServiceAPIDE') as IPSSubSysServiceAPIDE[];
    }
    return this.allpssubsysserviceapides;
  }

  get allPSSubSysServiceAPIDEs(): IPSSubSysServiceAPIDE[] | null {
    return this.getAllPSSubSysServiceAPIDEs();
  }

  findPSSubSysServiceAPIDE(objKey: any): IPSSubSysServiceAPIDE | null {
    return this.getPSModel5('service.IPSSubSysServiceAPIDE', this.getAllPSSubSysServiceAPIDEs(), objKey) as IPSSubSysServiceAPIDE;
  }

  protected allpssubsysserviceapidtos: IPSSubSysServiceAPIDTO[] | null = null;

  getAllPSSubSysServiceAPIDTOs(): IPSSubSysServiceAPIDTO[] | null {
    if (this.allpssubsysserviceapidtos == null) {
      this.allpssubsysserviceapidtos = this.fillChildListModel(this.M.getAllPSSubSysServiceAPIDTOs, 'service.IPSSubSysServiceAPIDTO') as IPSSubSysServiceAPIDTO[];
    }
    return this.allpssubsysserviceapidtos;
  }

  get allPSSubSysServiceAPIDTOs(): IPSSubSysServiceAPIDTO[] | null {
    return this.getAllPSSubSysServiceAPIDTOs();
  }

  findPSSubSysServiceAPIDTO(objKey: any): IPSSubSysServiceAPIDTO | null {
    return this.getPSModel5('service.IPSSubSysServiceAPIDTO', this.getAllPSSubSysServiceAPIDTOs(), objKey) as IPSSubSysServiceAPIDTO;
  }

  get authAccessTokenUrl(): string {
    return this.M.authAccessTokenUrl;
  }

  get authClientId(): string {
    return this.M.authClientId;
  }

  get authClientSecret(): string {
    return this.M.authClientSecret;
  }

  get authMode(): 'NONE' | 'AUTHORIZATION_CODE' | 'PASSWORD' | 'CLIENT_CREDENTIALS' | 'IMPLICIT' | 'USER' | 'USER2' {
    return this.M.authMode;
  }

  get authParam(): string {
    return this.M.authParam;
  }

  get authParam2(): string {
    return this.M.authParam2;
  }

  get authParam3(): string {
    return this.M.authParam3;
  }

  get authParam4(): string {
    return this.M.authParam4;
  }

  get authScriptCode(): string {
    return this.M.authScriptCode;
  }

  get authTimeout(): number {
    return this.M.authTimeout != null ? this.M.authTimeout : -1;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get handler(): string {
    return this.M.handler;
  }

  get headerParams(): IModel {
    return this.M.headerParams;
  }

  get memo(): string {
    return this.M.memo;
  }

  get methodScriptCode(): string {
    return this.M.methodScriptCode;
  }

  get name(): string {
    return this.M.name;
  }

  protected psopenapi3schema: IPSOpenAPI3Schema | null = null;

  getPSOpenAPI3Schema(): IPSOpenAPI3Schema | null {
    if (this.psopenapi3schema != null) return this.psopenapi3schema;
    const value = this.M.getPSOpenAPI3Schema;
    if (value == null) {
      return null;
    }
    this.psopenapi3schema = this.getPSModel4('service.openapi.IPSOpenAPI3Schema', value, 'getPSOpenAPI3Schema') as IPSOpenAPI3Schema;
    return this.psopenapi3schema;
  }

  get psOpenAPI3Schema(): IPSOpenAPI3Schema | null {
    return this.getPSOpenAPI3Schema();
  }

  getPSOpenAPI3SchemaMust(): IPSOpenAPI3Schema {
    const value = this.getPSOpenAPI3Schema();
    if (value == null) {
      throw new Error('未指定OpenAPI3 Schema');
    }
    return value;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后端扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get predefinedType(): 'SAASADMIN' | 'WFSERVICE' | 'WFCALLBACK' | 'USERAUTH' | 'ORGSERVICE' | 'ORGCALLBACK' | 'CORESERVICE' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.predefinedType;
  }

  get serviceCodeName(): string {
    return this.M.serviceCodeName;
  }

  get serviceParam(): string {
    return this.M.serviceParam;
  }

  get serviceParam2(): string {
    return this.M.serviceParam2;
  }

  get serviceParam3(): string {
    return this.M.serviceParam3;
  }

  get serviceParam4(): string {
    return this.M.serviceParam4;
  }

  get servicePath(): string {
    return this.M.servicePath;
  }

  get serviceType(): 'DEFAULT' | 'IBIZCLOUD' | 'APPLICATION' | 'LOCAL' | 'MIDDLEPLATFORM' | 'USER' | 'USER2' {
    return this.M.serviceType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableServiceAPIDTO(): boolean {
    return this.M.enableServiceAPIDTO != null ? this.M.enableServiceAPIDTO : false;
  }

  get cls(): string {
    return 'PSSubSysServiceAPIImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'service.IPSSubSysServiceAPI') return true;
    return super.instanceof(cls);
  }
}
